﻿using Shop.RemoteModel.SpecTemplate;
using Shop.RemoteModel.SpecTemplate.Model;
using Shop.StoreGatewayModular.Interface;

namespace Shop.StoreGatewayModular.Service
{
    internal class SpecTemplateService : ISpecTemplateService
    {
        public long Add (SpecTemplateAdd datum)
        {
            return new AddSpecTemplate
            {
                Datum = datum
            }.Send();
        }

        public void Delete (long id)
        {
            new DeleteSpecTemplate
            {
                Id = id
            }.Send();
        }
        public Dictionary<long, int> SetSort (long id, int sort)
        {
            return new SetSpecTemplateSort
            {
                Id = id,
                Sort = sort
            }.Send();
        }
        public SpecTemplateDto Get (long id)
        {
            return new GetSpecTemplate
            {
                Id = id
            }.Send();
        }
        public SpecTemplateDto[] Gets (long templateId)
        {
            return new GetSpecTemplates
            {
                TemplateId = templateId
            }.Send();
        }
        public SpecTemplateItem[] GetItems (long templateId, string query)
        {
            return new GetSpecTemplateItem
            {
                TemplateId = templateId,
                QueryKey = query
            }.Send();
        }
        public bool Set (long id, SpecTemplateSet set)
        {
            return new SetSpecTemplate
            {
                Id = id,
                Datum = set
            }.Send();
        }

        public void SetIsEnable (long id, bool isEnable)
        {
            new SetSpecTemplateIsEnable
            {
                Id = id,
                IsEnable = isEnable
            }.Send();
        }
    }
}
